<template>
  
</template>

<script>
  import {ajax} from "@/store/yg/common/utils";

  export default {
    props: [
      'data', 'commit'
    ],
    computed: {
      uri() {
        return this.$store.state.edit.row.uri;
      }
    },
    watch: {
      'uri': {
        handler(newUri, oldUri) {
          this.reloadRuleIds(newUri);
        },
        immediate: true,
      }
    },

    methods: {
      reloadRuleIds(uri) {
        let req = {
          uri: uri,
          roleId: this.$store.state.edit.row.id
        };
        let attrs = {uri: '/control/roledr/list', type: 'main'};
        ajax('loadRuleIdsByRoleIdAndUri', req, attrs).then(res => {
          this.$store.state.edit.row.actionRuleIds = res;
        }, error => {
          console.log(error);
        });
      }
    },
    created(){
      console.log(this.$store.state.edit.row)
    },
  }
</script>


